package site.wanjiahao;


import site.wanjiahao.circle.CircleLinkedList;


public class Main {

    public static void main(String[] args) {
        ArrayListOptimize<Object> list = new ArrayListOptimize<>();

        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);
        System.out.println(list);

        list.add(1, 20);
        System.out.println(list);
        list.add(1, 40);
        System.out.println(list);

        list.add(0, 80);
        System.out.println(list);

        list.remove(0);
        System.out.println(list);

        list.add(20);
        list.add(30);
        list.add(40);

        System.out.println(list);

    }

    private static CircleLinkedList<Object> getObjects() {
        CircleLinkedList<Object> list = new CircleLinkedList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);
        list.add(6);
        System.out.println(list);
        System.out.println("------------------------");
        list.add(0, 10);
        System.out.println("add链表首部" + list);
        System.out.println("------------------------");
        list.add(3, 10);
        System.out.println("add链表通用情况" + list);
        System.out.println("------------------------");
        list.add(8, 10);
        System.out.println("add链表尾部情况" + list);
        System.out.println("------------------------");

        list.set(0, 100);
        System.out.println("set链表首部" + list);
        System.out.println("------------------------");
        list.set(3, 100);
        System.out.println("set链表通用情况" + list);
        System.out.println("------------------------");
        list.set(8, 100);
        System.out.println("set链表尾部情况" + list);
        System.out.println("------------------------");


        list.remove(0);
        System.out.println("remove链表首部" + list);
        System.out.println("------------------------");
        list.remove(2);
        System.out.println("remove链表通用情况" + list);
        System.out.println("------------------------");
        list.remove(6);
        System.out.println("remove链表尾部情况" + list);
        System.out.println("------------------------");
        return list;
    }

}
